home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / control / loop < prev    next >
Encoding:
Text File  |  1992-12-17  |  1.6 KB  |  32 lines

  1.  
  2.  
  3.           loop var first limit [increment] body
  4.                Loop is a looping command, similar in behavior to the
  5.                Tcl for statement, except that the loop statement
  6.                achieves substantially higher performance and is easier
  7.                to code when the beginning and ending values of a loop
  8.                are known, and the loop variable is to be incremented
  9.                by a known, fixed amount every time through the loop.
  10.  
  11.                 The var argument is the name of a Tcl variable that
  12.                will contain the loop index.  The loop index is set to
  13.                the value specified by first.  The Tcl interpreter is
  14.                invoked upon body zero or more times, where var is
  15.                incremented by increment every time through the loop,
  16.                or by one if increment is not specified.  Increment can
  17.                be negative in which case the loop will count
  18.                downwards.
  19.  
  20.                When var reaches limit, the loop terminates without a
  21.                subsequent execution of body.  For instance, if the
  22.                original loop parameters would cause loop to terminate,
  23.                say first was one, limit was zero and increment was not
  24.                specified or was non-negative, body is not executed at
  25.                all and loop returns.
  26.  
  27.                If a continue command is invoked within body then any
  28.                remaining commands in the current execution of body are
  29.                skipped, as in the for command.  If a break command is
  30.                invoked within body then the loop command will return
  31.                immediately.  Loop returns an empty string.
  32.